// index.vue.hbs
<script setup lang="ts">
import axios from 'axios'
import PCMPlayer from 'pcm-player'

const money = defineModel<number>()

const player = new PCMPlayer({
  inputCodec: 'Int16',
  channels: 2,
  sampleRate: 8000,
  flushTime: 2000,
  fftSize: 32,
})

async function onClick() {
  /** pcm */
  const res = await axios.get('http://192.168.1.167:8087/v1/tts')

  const pcm = new Uint16Array(res.data.data)

  player.feed(pcm)

  player.continue()
}
</script>

<template>
  <div class="Test-page">
    <h3>child：{{ money }}</h3>
    <button @click="onClick">
      点我
    </button>
  </div>
</template>
